const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let m;
let initArr = [];
rl.on("line", (line)=>{
    if(m === undefined) {
        m = Number( line.trim())
    } else {
        initArr = line.trim().split(" ").map(Number)
        console.log(getResult(m, initArr))
        // clear
        m = undefined;
        initArr.length = 0
    }
})

function getResult(m, initArr) {
    // 升序
    initArr.sort((a, b) => a - b)

    if(initArr.length === 1) {
        return Math.ceil(initArr[0]/m)
    }

    let total = initArr.reduce((acc, num)=> acc + num , 0)
    let min = Math.floor(total/m)
    let max = initArr.at(-1) + initArr.at(-2)
    let ans = Infinity
    while (min <= max) {
        let mid = Math.floor((min + max)/2)
        if(valid(m, initArr, mid)) {
            ans = Math.min(ans, mid)
            max = mid - 1
        } else {
            min = mid + 1
        }
    }
    return ans
}

function valid(m, initArr, mid) {
    let l = 0;
    let r = initArr.length -1
    let count = 0;
    while(l <= r) {
        if(l === r) {
            count++
            break
        }
        if(initArr[l] + initArr[r] <= mid) {
            count++
            l++
            r--
        } else {
            count++
            r--
        }
    }

    return count <= m

}